//
//  ZHFRadioDetailListCell.m
//  GoTraveling
//
//  Created by dllo on 15/12/26.
//  Copyright © 2015年 开发华佗. All rights reserved.
//

#import "ZHFRadioDetailListCell.h"

@interface ZHFRadioDetailListCell ()

@property (nonatomic,strong) UIImageView *headImageView;
@property (nonatomic,strong) UIImageView *listenImageView;
@property (nonatomic,strong) UILabel *listenCountLabel;

@end

@implementation ZHFRadioDetailListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews{
    
    self.headImageView = [[UIImageView alloc] initWithFrame:CGRectMake(20 * ADAPT_WIDTH, 15 * ADAPT_HEIGHT, 50 * ADAPT_WIDTH, 50 * ADAPT_HEIGHT)];
    self.headImageView.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.headImageView];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.headImageView.frame.origin.x + self.headImageView.frame.size.width + 5 * ADAPT_WIDTH, self.headImageView.frame.origin.y, SCREEN_WIDTH / 2, self.headImageView.frame.size.height / 2)];
    self.titleLabel.font = [UIFont systemFontOfSize:15];
    //    [self.titleLabel sizeToFit];
    [self.contentView addSubview:self.titleLabel];
    
    self.listenImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.titleLabel.frame.origin.x, self.titleLabel.frame.origin.y + self.titleLabel.frame.size.height + 10 * ADAPT_HEIGHT, 20 * ADAPT_WIDTH, 20 * ADAPT_HEIGHT)];
    self.listenImageView.image = [UIImage imageNamed:@"iconfont-shengyin.png"];
    [self.contentView addSubview:self.listenImageView];
    
    self.listenCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.listenImageView.frame.origin.x + self.listenImageView.frame.size.width + 5 * ADAPT_WIDTH, self.listenImageView.frame.origin.y, 100 * ADAPT_WIDTH, self.listenImageView.frame.size.height)];
    self.listenCountLabel.textColor = [UIColor grayColor];
    self.listenCountLabel.font = [UIFont systemFontOfSize:11.f];
    [self.contentView addSubview:self.listenCountLabel];
    
    self.playImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.headImageView.frame.origin.x + self.headImageView.frame.size.width + 260 * ADAPT_WIDTH, self.headImageView.frame.origin.y + self.headImageView.frame.size.height / 4, self.headImageView.frame.size.height / 2, self.headImageView.frame.size.height / 2)];
    //    self.playImageView.backgroundColor = [UIColor grayColor];
    self.playImageView.image = [UIImage imageNamed:@"iconfont-bofang-2.png"];
    [self.contentView addSubview:self.playImageView];
    
}

- (void)setRadioDL:(ZHFRadioDetailList *)radioDL{
    
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:radioDL.coverimg] placeholderImage:[UIImage imageNamed:@"trip_edit_empty_content@2x.png"]];
    self.titleLabel.text = radioDL.title;
    self.titleLabel.frame = CGRectMake(self.headImageView.frame.origin.x + self.headImageView.frame.size.width + 5 * ADAPT_WIDTH, self.headImageView.frame.origin.y, SCREEN_WIDTH / 2, self.headImageView.frame.size.height / 2);
    [self.titleLabel sizeToFit];
    self.listenCountLabel.text = radioDL.musicVisit;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
